Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | 3x 3x 3x 3x 2x 3x | import { getSession } from "@/lib/auth";
import { redirect, permanentRedirect } from "next/navigation";
import { getDb } from "@/lib/db";
import { requireCollectionAccess } from "@/lib/collection-access";
interface Props {
params: Promise<{ id: string; itemNumber: string }>;
}
// The item panel replaced the photos page (spec 2026-10-01 ยง3). Kept only to bounce old
// links. The guard runs FIRST (page-authz-enumeration exact-matches the stranger's
// redirect); the number is used only when it is all digits, never interpolated raw.
export default async function ItemPhotosRedirect({ params }: Props) {
const { id, itemNumber } = await params;
const session = await getSession();
Iif (!session?.user) {
redirect("/login");
}
const collection = await requireCollectionAccess(getDb(), id, session.user.id);
const home = `/collections/${collection.slug ?? collection.id}`;
permanentRedirect(/^\d+$/.test(itemNumber) ? `${home}/items/${itemNumber}` : home);
}
|